<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>修改商品</title>
    <meta charset="UTF-8"/>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/font-awesome.min.css">
</head>
<body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
    <!-- logo位 -->
    <a class="navbar-brand" href="#">
        <img src="/img/logo.png" height="30" class="d-inline-block align-top" alt="">
        Mall电商运营平台
    </a>
    <!-- 导航位 -->
    <ul class="navbar-nav mr-auto">
        <li class="nav-item">
            <a class="nav-link" href="/product/DataView">数据看板</a>
        </li>
        <li class="nav-item">
            <a class="nav-link active" href="/product/List">商品维护</a>
        </li>

        <li class="nav-item">
            <a class="nav-link" href="/user/List">会员管理</a>
        </li>
    </ul>
    <!-- 个人中心 -->
    <span class="navbar-text"><a class="nav-link " href="#" th:href="@{/adminInfo(name=${userName})}"><i class="fa fa-user"></i>个人中心[<span th:text="${userName}"></span>]</a></span>
</nav>
<div class="container-fluid" style="margin-top: 100px;">
    <div class="row">
        <div class="col-md-3"></div>
        <div class="col-md-6">
            <form action="/updateProduct" method="post" enctype="multipart/form-data" >
                <table class="text-center table table-bordered" align="center" width="100%">
                    <tr  class="bg-light text-black-50">
                        <th colspan="2" ><h3>修改商品信息</h3></th>
                    </tr>
<!--                    <input type="hidden" name="productId" th:value="${product.id}">-->
                    <tr>
                        <td style="width: 150px;">名称：</td>
                        <input type="hidden" name="productId" th:value="${product.id}">
                        <td><input class="form-control" placeholder="商品名称" type="text" name="productName" th:value="${product.productName}" ></td>
                    </tr>
                    <tr>
                        <td>单价：</td>
                        <td><input class="form-control" placeholder="单价" type="number" name="price" th:value="${product.price}"></td>
                    </tr>
                    <tr>
                        <td>库存：</td>
                        <td><input class="form-control" placeholder="库存" type="number"  name="stock"th:value="${product.stock}"></td>
                    </tr>
                    <tr>
                        <td>图片：</td>
                        <td>
                            <img th:src="${product.imageUrl}"
                                 class="img-fluid img-thumbnail"
                                 alt=""
                                 style="width: 100px; height: 40%; object-fit: cover;">
                        </td>
                    </tr>
                    <tr>
                        <td>商品图片：</td>
                        <td>
                            <div class="custom-file">
                                <input type="file" name="imageUrl" class="custom-file-input" id="customFile">
                                <label class="custom-file-label" for="customFile">选择文件</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>详情：</td>
                        <td><input class="form-control" placeholder="商品描述" type="text" name="description" th:value="${product.description}"></td>
                    </tr>
                    <tr>
                        <td><input class="btn btn-outline-warning" style="width: 100px" onclick="history.go(-1)" value="返回"></td>
                        <td><input class="btn btn-success" style="width: 200px" type="submit" value="修改"></td>
                        <td><input class="btn btn-outline-warning" type="reset" value="清空"></td>
                    </tr>
                </table>
            </form>
        </div>
        <div class="col-md-3"></div>
    </div>
</div>
</body>
</html>
